class Common {
    static splitStr(id, value, extra = "d") {
        switch (extra) {
            case "d":
                return `${id} = '${value}'`;
            case "!=":
                return `${id} != '${value}'`;
            case "empty":
                return `${id} IS NULL`;
            case "not empty":
                return `${id} IS NOT NULL or ${id} = ''`;
            case "=":
                return `${id}='${value}' and ${id} != ''`;
            case "m":
                return `${id} like '%${value}%'`;
            case "b":
                value = value.map((val) => `'${val}'`).join(',');
                return `${id} IN (${value})`;
            case ">":
            case ">=":
            case "<=":
            case "<":
                return `${id} ${extra} '${value}'`;
            default:
                return `${id}='${value}'`;
        }
    }
}

globalThis.$common = Common;